package com.marktotop.service.impl;

import com.marktotop.service.UserService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * 注解驱动使用
 *              "@Controller  @Service  @Repository是 @Component 的衍生注解，功能同@Component "
 * @author WXLD
 * @data 2021/4/18 - 21:46
 */
@Component("userService")
public class UserServiceImpl implements UserService {


    /**
     * userService Bean 的生命周期注解要加载方法头部
     */
    @PostConstruct
    public void init(){
        System.out.println("User Service Init.....");
    }

    /**
     * userService Bean 的生命周期注解要加载方法头部
     */
    @PreDestroy
    public void destroy(){
        System.out.println("UserService Destroy.....");
    }

    @Override
    public void save() {
        System.out.println("User Service Run.....");
    }


}
